--[[
 -- *名称:FlyScorePart
 -- *描述:结算飘分层
 -- *版权:Copyright © 2016-2018 深圳市三只小熊科技有限公司 版权所有
 -- *作者:Administrator
 -- *创建日期:2017-11-15
 -- *修改日期:2017-11-15
 ]]
local CURRENT_MODULE_NAME = ...;
local FlyScorePart = class("FlyScorePart",PokerPartBase); --登录模块
FlyScorePart.DEFAULT_PART = {};
FlyScorePart.DEFAULT_VIEW = "flyscorelayer";
---
 -- [ctor 默认part构造方法]
 -- @DateTime 2017-09-20
 -- @param    owner [description]
 -- @param    data [description]
 -- @return    [description]
 --
function FlyScorePart:ctor(owner, data)
    FlyScorePart.super.ctor(self, owner, data)
    self._data = data;
end
---
 -- [activate 默认激活该part调用方法]
 -- @DateTime 2017-09-20
 -- @param    data [description]
 -- @return    [description]
 --
function FlyScorePart:activate(data)
	FlyScorePart.super.activate(self, CURRENT_MODULE_NAME);
end
---
 -- [deactivate 销毁该part调用方法]
 -- @DateTime 2017-09-20
 -- @return   [description]
 --
function FlyScorePart:deactivate()
    FlyScorePart.super.deactivate(self);
    if self.view == nil then
		return
	else
		self.view:removeSelf()
		self.view =  nil
	end
end
---
 -- [getPartId 获取该part的partId]
 -- @DateTime 2017-09-20
 -- @return   [description]
 --
function FlyScorePart:getPartId()
	-- body
	return "FlyScorePart"
end
---
 -- 结算
 -- @DateTime 2017-11-15
 -- @param    data [description]
 -- @return    [description]
 --
function FlyScorePart:_onGameOver( data )
	local tableInfo = data.tableInfo;
	if tableInfo.tableState ~= DdzGameConfig.TableState.ROUND_OVER then -- 小结算状态
		return;
	end

	local scoreData = {};
	for k, v in ipairs(tableInfo.players or {}) do 
		local info = {};
		info.viewId = DdzGameData.getInstance():getViewIdBySeatId(v.tablePos);
		info.score = v.roundInfos[#v.roundInfos].roundScore;

		table.insert(scoreData, info);
	end

	self:doView("playFlyaingScore", scoreData);
end
---
 -- 测试飘分
 -- @DateTime 2017-11-15
 -- @param    data [description]
 -- @return    [description]
 --
function FlyScorePart:_tesFlyingScore( data )
	self:doView("playFlyaingScore", data);
end

FlyScorePart.eventFuncMap = {
	[DdzEventConfig.EVENT_TEST_FLYING_SCORE]	= FlyScorePart._tesFlyingScore;	
};

return FlyScorePart 